{include file="public/top" /}
<style>
    .layui-field-title{margin-top: 20px}
    .parameter-mm{min-height: 100px;width: 45%;}
    .product-img-list{height: 115px;width: 90%}
    .product-img{height: 80px;width: 120px;margin: 0 10px 0 0;cursor:pointer;}
    .layui-collapse{border-width: 0;}
    .parameter-title{width: 100%;height: 40px;}
    .parameter-title span{width: 100px;height: 35px;background: #c2c2c2;display: inline-block;text-align: center;line-height: 35px;color: white}
    .parameter-mm-table{background: #fefefe;min-height: 100px;border-radius: 3px}
    .coo-btn{min-width: 100px;width:auto;padding-left:5px;padding-right:5px;height: 35px;border-radius: 3px;cursor: pointer;color: #fefefe;border: none;display: inline-block;margin-top: 10px}
    .coo-btn-df{background: #ededed  !important;color: #222222}
    .coo-btn-df:hover{background: #e0e0e0 !important;color: #0C0C0C}
    .coo-btn-blue{background: #428bca !important;color: white}
    .coo-btn-blue:hover{background: #1d6fa6 !important;color: white}
    .parameter-mm-table, .parameter-mm-table-th, .parameter-mm-table-td {border: 1px solid #cccccc;text-align: center;border-radius: 10px;margin-top: 10px}
    .parameter-mm-table-th, .parameter-mm-table-td{height: 40px}
    .coo-input{height: 32px;border-radius: 3px;border: 1px solid #cccccc;padding-left: 5px}
    .coo-input:hover{border: 1px solid #428bca;padding-left: 5px}
    .parts-li{float: left;margin-top: 10px}
    .parts-li-img{height: 110px;width: 150px;margin: 0 20px 0 0;}
    .parts-li-img:hover {opacity: 0.4;cursor: pointer;}
    .parts-li-span{float: left;background: white;cursor:pointer;color: red;border-radius: 2px;font-weight: bold;width: 17px;position: relative;
        margin-right: -30px;margin-top: -109px;margin-left: 1px;}
    .parts-li-select-span{float: left;cursor:pointer;position: relative;margin-right: -30px;margin-top: -119px;margin-left: 1px;}
    .parts-li-div{word-break: break-all;white-space: pre-wrap;width: 150px;overflow:hidden;height:75px;}

    .img-spans-box{position:relative; margin:20px auto;width:130px;height:90px;display: inline-block;}
    .img-shadow-box{position: absolute;height: 80px;width: 120px;cursor: pointer;float: left;}
    .img-shadow-span{position: absolute;height: 80px;width: 120px;z-index: 99;float: left;background: #111;opacity: 0.2;display: inline-block;top: 0;border: 1px solid white;}
    .img-shadow-box:hover  .img-shadow-box-son{display: block;}
    .img-shadow-box-son{display: none}
    .img-shadow-icon{display: flex;justify-content:center;align-items:Center;margin: 0 auto;}
    .img-shadow-icon span{margin-top: 25px;font-weight: 600;}
    .img-shadow-icon span i{font-size: 30px;color: red;z-index: 100;}


    .product-img-spans-box{position:relative; margin:20px auto;height: 95px;width: 165px;display: inline-block;}
    .product-img-shadow-box{position: absolute;height: 110px;width:150px;cursor: pointer;float: left;}
    .product-img-shadow-span{position: absolute;height: 110px;width:150px;z-index: 99;float: left;background: #111;opacity: 0.2;display: inline-block;top: 0;border: 2px solid white;border-radius: 5px}
    .product-img-shadow-box:hover  .product-img-shadow-son{display: block;}
    .product-img-shadow-son{display: none;}

    .product-img-shadow-icon{display: flex;justify-content:center;align-items:Center;margin: 0 auto;}
    .product-img-shadow-icon span{margin-top: 30px;font-weight: 600;}
    .product-img-shadow-icon span i{font-size: 30px;color: red;z-index: 100;}

    .product-img-shadow-icon-select{display: flex;justify-content:center;align-items:Center;margin: 0 auto;}
    .product-img-shadow-icon-select span{margin-top: 30px;font-weight: 600;}
    .product-img-shadow-icon-select span i{font-size: 30px;color:#4cff22;z-index: 100;}
    .display-block{display: block}
</style>
<body>
<div class="x-body" id="example">
    <form class="layui-form" method="post" onsubmit="return false">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>产品分类</legend>
        </fieldset>
        <div class="video-box">
            <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
                <div class="video-input" style="width: 60%;">
                    <select id="type_id" name="type_id" class="valid">
                        <?php foreach($product_type_list as $val):?>
                        <option value="<?php echo $val['id'];?>" <?php if($val['id'] == $data['type_id']):?>selected=''<?php endif?>><?php echo $val['name'];?></option>
                        <?php endforeach;?>
                    </select>
                </div>
            </div>
        </div>

        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>产品标签</legend>
        </fieldset>
        <div class="video-box">
            <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
                <div class="video-input" style="width: 60%;">
                    <select id="label_id" name="label_id" class="valid">
                        <?php foreach($label_list as $val):?>
                        <option value="<?php echo $val['id'];?>" <?php if($val['id'] == $data['label_id']):?>selected=''<?php endif?>><?php echo $val['name'];?></option>
                        <?php endforeach;?>
                    </select>
                </div>
            </div>
        </div>

        <!--产品名称-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>产品名称</legend>
        </fieldset>
        <div class="video-box">
            <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
                <div class="video-input" style="width: 60%;">
                    <input type="text" class="coo-input" name="name" style="width: 100%;" placeholder="输入产品名称" value="<?php echo $data['name'];?>">
                </div>
            </div>
        </div>
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>产品标题</legend>
        </fieldset>
        <div class="video-box">
            <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
                <div class="video-input" style="width: 60%;">
                    <input type="text" class="coo-input" name="title" style="width: 100%;" placeholder="输入产品标题" value="<?php echo $data['title'];?>">
                </div>
            </div>
        </div>

        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>产品关键字</legend>
        </fieldset>
        <div class="video-box">
            <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
                <div class="video-input" style="width: 60%;">
                    <input type="text" class="coo-input" name="keyword" style="width: 100%;" placeholder="输入产品关键字，多个关键字使用英文逗号隔开" value="<?php echo $data['keyword'];?>">
                </div>
            </div>
        </div>
        <!--产品介绍-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>产品描述</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%"><!--style="height:360px"-->
            <textarea placeholder="输入产品描述" id="description" name="description" class="layui-textarea">{$data.description}</textarea>
        </div>
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>产品排序</legend>
        </fieldset>
        <div class="video-box">
            <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
                <div class="video-input" style="width: 60%;">
                    <input type="text" class="coo-input" name="sort" style="width: 100%;" placeholder="输入产品产品排序" value="<?php echo $data['sort'];?>">
                </div>
            </div>
        </div>
        <!--产品图片-->
        <fieldset class="layui-elem-field layui-field-title">
            <legend>产品封面</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px">
            <div class="product-img-list">
                <span class="product_img_box">
                    <?php if($data['img_arr']):?>
                    <?php foreach($data['img_arr'] as $val):?>
                    <span onclick="_removeThis(this)" title="点击删除图片" class="img-spans-box">
                            <div class="img-shadow-box">
                                <div class="img-shadow-box-son">
                                    <div class="img-shadow-icon">
                                        <span><i class="icon iconfont"></i></span>
                                    </div>
                                    <span class="img-shadow-span"></span>
                                </div>
                            </div>
                            <img class="product-img" src="<?php echo $val;?>">
                            <input type="hidden" name="product_img[]" value="<?php echo $val;?>">
                        </span>
                    <?php endforeach;?>
                    <?php endif;?>
                </span>
                <label for="product_img_button" style="clear: both">
                    <img class="product-img" src="__ADMIN__images/addLogo_box.png">
                </label>
                <span style="display: inline-block;">图片尺寸 394 * 300 支持 png，jpg格式，多图</span>
            </div>

            <button type="button" style="margin: 5px 0 0 0;display: none" class="layui-btn layui-btn-small" id="product_img_button">
                <i class="layui-icon">&#xe67c;</i>上传图片
            </button>
        </div>

        <!--产品图片-->
        <fieldset class="layui-elem-field layui-field-title">
            <legend>产品图片</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px">
            <div class="product-img-list">
                <span class="product_cover_box">
                    <?php if($data['cover_arr']):?>
                    <?php foreach($data['cover_arr'] as $val):?>
                    <span onclick="_removeThis(this)" title="点击删除图片" class="img-spans-box">
                                <div class="img-shadow-box">
                                    <div class="img-shadow-box-son">
                                        <div class="img-shadow-icon">
                                            <span><i class="icon iconfont"></i></span>
                                        </div>
                                        <span class="img-shadow-span"></span>
                                    </div>
                                </div>
                                <img class="product-img" src="<?php echo $val;?>">
                                <input type="hidden" name="cover_img[]" value="<?php echo $val;?>">
                            </span>
                    <?php endforeach;?>
                    <?php endif;?>
                </span>
                <label for="product_cover_button" style="clear: both">
                    <img class="product-img" src="__ADMIN__images/addLogo_box.png">
                </label>
                <span style="display: inline-block;">图片尺寸 1920 * 600 支持 png，jpg格式，多图</span>
            </div>
            <button type="button" style="margin: 5px 0 0 0;display: none" class="layui-btn layui-btn-small" id="product_cover_button">
                <i class="layui-icon">&#xe67c;</i>上传图片
            </button>
        </div>
        <!--产品图片-->
        <fieldset class="layui-elem-field layui-field-title">
            <legend>产品手机图片</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px">
            <div class="product-img-list">
                <span class="product_tel_box">
                    <?php if($data['tel_img_arr']):?>
                    <?php foreach($data['tel_img_arr'] as $val):?>
                    <span onclick="_removeThis(this)" title="点击删除图片" class="img-spans-box">
                                <div class="img-shadow-box">
                                    <div class="img-shadow-box-son">
                                        <div class="img-shadow-icon">
                                            <span><i class="icon iconfont"></i></span>
                                        </div>
                                        <span class="img-shadow-span"></span>
                                    </div>
                                </div>
                                <img class="product-img" src="<?php echo $val;?>">
                                <input type="hidden" name="tel_product_img[]" value="<?php echo $val;?>">
                            </span>
                    <?php endforeach;?>
                    <?php endif;?>
                </span>
                <label for="product_tel_button" style="clear: both">
                    <img class="product-img" src="__ADMIN__images/addLogo_box.png">
                </label>
                <span style="display: inline-block;">图片尺寸750*375 支持 png，jpg格式，多图</span>
            </div>
            <button type="button" style="margin: 5px 0 0 0;display: none" class="layui-btn layui-btn-small" id="product_tel_button">
                <i class="layui-icon">&#xe67c;</i>上传图片
            </button>
        </div>
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>产品图片Alt</legend>
        </fieldset>
        <div class="video-box">
            <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
                <div class="video-input" style="width: 60%;">
                    <input type="text" class="coo-input" name="alt" style="width: 100%;" placeholder="输入产品图片Alt" value="<?php echo $data['alt'];?>">
                </div>
            </div>
        </div>
        <!--产品介绍-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>产品简介</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%"><!--style="height:360px"-->
            <textarea placeholder="输入产品简介" id="introduce" name="introduce" class="layui-textarea"><?php echo $data['introduce'];?></textarea>
        </div>

        <!--产品描述-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>产品详情</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%"><!--style="height:360px"-->
            <script type="text/plain" id="editor" class="ueueueue"><?php echo $data['desc'];?></script>
        </div>

        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>产品参数</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;">
            <div class="parameter-mm" style="float: left">
                <div class="parameter-title">
                    <span class="coo-btn coo-btn-blue" onclick="_paramsDataPushRow()">添加一行</span>
                </div>
                <table class="parameter-mm-table params-data-table" border="1">
                    <tr>
                     <!--    <th style="width: 350px;background: #e6e6e6;height: 40px">Model</th>
                        <th style="width: 350px;background: #e6e6e6;height: 40px">Working Area</th>
                        <th style="width: 350px;background: #e6e6e6;height: 40px">Laser Output Power</th>
                        <th style="width: 350px;background: #e6e6e6;height: 40px">Max Speed</th> -->
                        <th style="width: 350px;background: #e6e6e6;height: 40px"><input type="text"  class="coo-input" name="table_name1" value="<?php echo $data['table_name1'];?>"></th>
                        <th style="width: 350px;background: #e6e6e6;height: 40px"><input type="text"  class="coo-input" name="table_name2" value="<?php echo $data['table_name2'];?>"></th>
                        <th style="width: 350px;background: #e6e6e6;height: 40px"><input type="text"  class="coo-input" name="table_name3" value="<?php echo $data['table_name3'];?>"></th>
                        <th style="width: 350px;background: #e6e6e6;height: 40px"><input type="text"  class="coo-input" name="table_name4" value="<?php echo $data['table_name4'];?>"></th>

                        <th style="width: 260px;background: #e6e6e6;height: 40px">操作</th>
                    </tr>
                    <?php if(isset($data['params_arr']['model']) && $data['params_arr']['model']):?>
                    <?php foreach($data['params_arr']['model'] as $key => $val):?>
                    <tr>
                        <td class="parameter-mm-table-td" width="350px"><input type="text" class="coo-input" name="params[model][]" value="<?php echo @$val?>"></td>
                        <td class="parameter-mm-table-td" width="350px"><input type="text" class="coo-input" name="params[working][]" value="<?php echo @$data['params_arr']['working'][$key];?>"></td>
                        <td class="parameter-mm-table-td" width="350px"><input type="text" class="coo-input" name="params[laser][]" value="<?php echo @$data['params_arr']['laser'][$key];?>"></td>
                        <td class="parameter-mm-table-td" width="350px"><input type="text" class="coo-input" name="params[size][]" value="<?php echo @$data['params_arr']['size'][$key];?>"></td>
                        <td class="parameter-mm-table-td" width="260px"><span class="" style="display: block;width: 100px;cursor: pointer;" onclick="_paramsDataRemoveRow(this)">删除</span></td>
                    </tr>
                    <?php endforeach;?>
                    <?php endif;?>
                </table>

            </div>
        </div>



        <!--产品视频-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>产品视频</legend>
        </fieldset>
        <div class="video-box">
            <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
                <div class="video-input" style="width: 60%;">
                    <input type="text" class="coo-input" style="width: 100%;" name="product_video_url" placeholder="输入视频地址链接" value="<?php echo $data['video'];?>">
                </div>
            </div>
        </div>
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>优势说明</legend>
        </fieldset>
        <div class="video-box">
            <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
                <div class="video-input" style="width: 60%;">
                    <input type="text" class="coo-input" name="parts_intro" style="width: 100%;" placeholder="输入优势说明" value="{$data.parts_intro}">
                </div>
            </div>
        </div>
        <!--产品优势--><!--parts advantage-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>产品优势</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
            <ul class="select_parts_ul">
                <?php if($data['parts_arr']):?>
                <?php foreach($data['parts_arr'] as $val):?>
                <li class="parts-li">
                    <div class="product-img-spans-box" onclick="_removeSelectElement(this)" data-id="<?php echo $val['id'];?>" data-element="parts">
                        <div class="product-img-shadow-box">
                            <div class="product-img-shadow-son ">
                                <div class="product-img-shadow-icon">
                                    <span style="margin-top: 45px;"><i class="icon iconfont"></i></span>
                                </div>
                                <span class="product-img-shadow-span" ></span>
                            </div>
                        </div>
                        <img  class="parts-li-img" src="<?php echo $val['img_url'];?>">
                    </div>
                    <div class="parts-li-div"><?php echo $val['name'];?></div>
                    <input type="hidden" name="parts_input[]" value="<?php echo $val['id'];?>" class="parts_input">
                </li>
                <?php endforeach;?>
                <?php endif;?>
            </ul>
        </div>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%;min-height: 120px;height: auto">
            <div class="layui-collapse" lay-accordion>
                <div class="layui-colla-item">
                    <h2 class="layui-colla-title">选择产品优势<h2>
                        <div class="layui-colla-content layui-show" style="clear: both">
                            <?php foreach($parts_type_list as $val):?>
                            <button class="coo-btn coo-btn-df parts-category" type="button" data-id="<?php echo $val['id'];?>"><?php echo $val['name'];?></button>
                            <?php endforeach;?>
                            <div style="omargin-top: 20px;clear: both;">
                                <ul class="set_parts_ul"></ul>
                            </div>
                            <input type="hidden" id="parts_category" value="0">
                        </div>
                </div>
            </div>
        </div>

        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;clear: both">
            <legend>技术参数</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%"><!--style="height:360px"-->
            <script type="text/plain" id="editor1" class="ueueueue">{$data.canshu}</script>
        </div>

        <!--3D效果图-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 40px;">
            <legend>3D效果图</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px">
            <div class="layui-form-item" style="margin-top: 10px">
                <div class="product-img-list">
                        <span class="deffect_img_box" >
                             <?php if($data['dimensional']):?>
                            <div class="file_site">文件地址：<?php echo $data['dimensional'];?></div>
                                <span onclick="_removeThis(this)" title="点击删除图片" class="img-spans-box">
                                    <div class="img-shadow-box">
                                        <div class="img-shadow-box-son">
                                            <div class="img-shadow-icon">
                                                <span><i class="icon iconfont"></i></span>
                                            </div>
                                            <span class="img-shadow-span"></span>
                                        </div>
                                    </div>
                                    <img class="product-img" src="__ADMIN__images/zip.png">
                                    <input type="hidden" name="deffect_img" value="<?php echo $data['dimensional'];?>">
                                </span>
                            <?php endif;?>
                        </span>
                    <label class="parameters-box" for="deffect_img_button" style="clear: both">
                        <img style="height: 80px;width: 120px;margin: 0 10px 0 0;cursor:pointer;" src="__ADMIN__images/addLogo_box.png">
                    </label>
                    <span style="display: inline-block;">附件 支持 pdf，xlsx，doc等格式</span>
                </div>

                <button type="button" style="margin: 5px 0 0 0;display: none" class="layui-btn layui-btn-small" id="deffect_img_button">
                    <i class="layui-icon">&#xe67c;</i>上传图片
                </button>
            </div>
        </div>



        <!--样品-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>样品库</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
            <ul class="select_sample_ul">
                <?php if($data['sample_arr']):?>
                <?php foreach($data['sample_arr'] as $val):?>
                <li class="parts-li">
                    <div class="product-img-spans-box" onclick="_removeSelectElement(this)" data-id="<?php echo $val['id'];?>" data-element="sample">
                        <div class="product-img-shadow-box">
                            <div class="product-img-shadow-son ">
                                <div class="product-img-shadow-icon">
                                    <span style="margin-top: 45px;"><i class="icon iconfont"></i></span>
                                </div>
                                <span class="product-img-shadow-span" ></span>
                            </div>
                        </div>
                        <img  class="parts-li-img" src="<?php echo $val['img_url'];?>">
                    </div>
                    <div class="parts-li-div"><?php echo $val['name'];?></div>
                    <input type="hidden" name="sample_input[]" value="<?php echo $val['id'];?>" class="sample_input">
                </li>

                <?php endforeach;?>
                <?php endif;?>
            </ul>
        </div>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%;min-height: 120px;height: auto">
            <div class="layui-collapse" lay-accordion>
                <div class="layui-colla-item">
                    <h2 class="layui-colla-title">选择样品</h2>
                    <div class="layui-colla-content layui-show" style="clear: both">
                        <?php foreach($sample_type_list as $val):?>
                        <button class="coo-btn coo-btn-df sample-category" type="button" data-id="<?php echo $val['id'];?>"><?php echo $val['name'];?></button>
                        <?php endforeach;?>
                        <div style="margin-top: 20px;clear: both;">
                            <ul class="set_sample_ul"></ul>
                        </div>

                        <input type="hidden" id="sample_page" value="1">
                        <input type="hidden" id="sample_category" value="0">
                    </div>
                </div>
            </div>
        </div>

        <!--&lt;!&ndash;应用&ndash;&gt;-->
        <!--<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">-->
            <!--<legend>应用库</legend>-->
        <!--</fieldset>-->
        <!--<div class="layui-form-item" style="margin-left: 30px;width: 90%;">-->
            <!--<ul class="select_application_ul">-->
                <!--<?php if($data['application_arr']):?>-->
                <!--<?php foreach($data['application_arr'] as $val):?>-->
                <!--<li class="parts-li">-->
                    <!--<div class="product-img-spans-box" onclick="_removeSelectElement(this)" data-id="<?php echo $val['id'];?>" data-element="application">-->
                        <!--<div class="product-img-shadow-box">-->
                            <!--<div class="product-img-shadow-son ">-->
                                <!--<div class="product-img-shadow-icon">-->
                                    <!--<span style="margin-top: 45px;"><i class="icon iconfont"></i></span>-->
                                <!--</div>-->
                                <!--<span class="product-img-shadow-span" ></span>-->
                            <!--</div>-->
                        <!--</div>-->
                        <!--<img  class="parts-li-img" src="<?php echo $val['cover_url'];?>">-->
                    <!--</div>-->
                    <!--<div class="parts-li-div"><?php echo $val['name'];?></div>-->
                    <!--<input type="hidden" name="application_input[]" value="<?php echo $val['id'];?>" class="application_input">-->
                <!--</li>-->
                <!--<?php endforeach;?>-->
                <!--<?php endif;?>-->
            <!--</ul>-->
        <!--</div>-->
        <!--<div class="layui-form-item" style="margin-left: 30px;width: 90%;min-height: 120px;height: auto">-->
            <!--<div class="layui-collapse" lay-accordion>-->
                <!--<div class="layui-colla-item">-->
                    <!--<h2 class="layui-colla-title">选择应用</h2>-->
                    <!--<div class="layui-colla-content layui-show" style="clear: both">-->
                        <!--<?php foreach($application_type_list as $val):?>-->
                        <!--<button class="coo-btn coo-btn-df application-category" type="button" data-id="<?php echo $val['id'];?>"><?php echo $val['name'];?></button>-->
                        <!--<?php endforeach;?>-->
                        <!--<div style="margin-top: 20px;clear: both;">-->
                            <!--<ul class="set_application_ul"></ul>-->
                        <!--</div>-->
                    <!--</div>-->
                <!--</div>-->
            <!--</div>-->
        <!--</div>-->

        <!--相关知识-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>相关知识</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
            <ul class="select_lore_ul">
                <?php if($data['lore_arr']):?>
                <?php foreach($data['lore_arr'] as $val):?>
                <li class="parts-li">
                    <div class="product-img-spans-box" onclick="_removeSelectElement(this)" data-id="<?php echo $val['id'];?>" data-element="lore">
                        <div class="product-img-shadow-box">
                            <div class="product-img-shadow-son ">
                                <div class="product-img-shadow-icon">
                                    <span style="margin-top: 45px;"><i class="icon iconfont"></i></span>
                                </div>
                                <span class="product-img-shadow-span" ></span>
                            </div>
                        </div>
                        <img  class="parts-li-img" src="<?php echo $val['img_url'];?>">
                    </div>
                    <div class="parts-li-div"><?php echo $val['name'];?></div>
                    <input type="hidden" name="lore_input[]" value="<?php echo $val['id'];?>" class="lore_input">
                </li>

                <?php endforeach;?>
                <?php endif;?>
            </ul>
        </div>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%;min-height: 120px;height: auto">
            <div class="layui-collapse" lay-accordion>
                <div class="layui-colla-item">
                    <h2 class="layui-colla-title">选择相关知识</h2>
                    <div class="layui-colla-content layui-show" style="clear: both">
                        <?php foreach($lore_type_list as $val):?>
                        <button class="coo-btn coo-btn-df lore-category" type="button" data-id="<?php echo $val['id'];?>">
                            <?php echo $val['name'];?></button>
                        <?php endforeach;?>
                        <div style="margin-top: 20px;clear: both;">
                            <ul class="set_lore_ul"></ul>
                        </div>

                        <input type="hidden" id="lore_page" value="1">
                        <input type="hidden" id="lore_category" value="0">

                    </div>
                </div>
            </div>
        </div>

        <!--部件特点-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>部件特点</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
            <ul class="select_bujian_ul">
                <?php if($data['bujian_arr']):?>
                <?php foreach($data['bujian_arr'] as $val):?>
                <li class="parts-li">
                    <div class="product-img-spans-box" onclick="_removeSelectElement(this)" data-id="<?php echo $val['id'];?>" data-element="bujian">
                        <div class="product-img-shadow-box">
                            <div class="product-img-shadow-son ">
                                <div class="product-img-shadow-icon">
                                    <span style="margin-top: 45px;"><i class="icon iconfont"></i></span>
                                </div>
                                <span class="product-img-shadow-span" ></span>
                            </div>
                        </div>
                        <img  class="parts-li-img" src="<?php echo $val['img_url'];?>">
                    </div>
                    <div class="parts-li-div"><?php echo $val['name'];?></div>
                    <input type="hidden" name="bujian_input[]" value="<?php echo $val['id'];?>" class="bujian_input">
                </li>
                <?php endforeach;?>
                <?php endif;?>
            </ul>
        </div>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%;min-height: 120px;height: auto">
            <div class="layui-collapse" lay-accordion>
                <div class="layui-colla-item">
                    <h2 class="layui-colla-title">选择部件特点</h2>
                    <div class="layui-colla-content layui-show" style="clear: both">
                        <?php foreach($bujian_type_list as $val):?>
                        <button class="coo-btn coo-btn-df bujian-category" type="button" data-id="<?php echo $val['id'];?>">
                            <?php echo $val['name'];?></button>
                        <?php endforeach;?>
                        <div style="margin-top: 20px;clear: both;">
                            <ul class="set_bujian_ul"></ul>
                        </div>

                        <input type="hidden" id="bujian__page" value="1">
                        <input type="hidden" id="bujian__category" value="0">
                    </div>
                </div>
            </div>
        </div>

        <!--推荐产品-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>推荐产品</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
            <ul class="select_product_ul">
                <?php if($data['product_arr']):?>
                <?php foreach($data['product_arr'] as $val):?>
                <li class="parts-li">
                    <div class="product-img-spans-box" onclick="_removeSelectElement(this)" data-id="<?php echo $val['id'];?>" data-element="product">
                        <div class="product-img-shadow-box">
                            <div class="product-img-shadow-son ">
                                <div class="product-img-shadow-icon">
                                    <span style="margin-top: 45px;"><i class="icon iconfont"></i></span>
                                </div>
                                <span class="product-img-shadow-span" ></span>
                            </div>
                        </div>
                        <img  class="parts-li-img" src="<?php echo @json_decode($val['img'], true)[0];?>">
                    </div>
                    <div class="parts-li-div"><?php echo $val['name'];?></div>
                    <input type="hidden" name="product_input[]" value="<?php echo $val['id'];?>" class="product_input">
                </li>
                <?php endforeach;?>
                <?php endif;?>
            </ul>
        </div>

        <div class="layui-form-item" style="margin-left: 30px;width: 90%;min-height: 120px;height: auto">
            <div class="layui-collapse" lay-accordion>
                <div class="layui-colla-item">
                    <h2 class="layui-colla-title">选择推荐产品</h2>
                    <div class="layui-colla-content layui-show" style="clear: both">
                        <?php foreach($product_type_list as $val):?>
                        <button class="coo-btn coo-btn-df product-category" type="button" data-id="<?php echo $val['id'];?>">
                            <?php echo $val['name'];?></button>
                        <?php endforeach;?>
                        <div style="margin-top: 20px;clear: both;">
                            <ul class="set_product_ul"></ul>
                        </div>
                        <input type="hidden" id="product_category" value="0">
                    </div>
                </div>
            </div>
        </div>

        <hr class="layui-bg-gray">

        <div class="layui-form-item" style="clear: both">
            <label class="layui-form-label">
            </label>
            <button type="button"  class="layui-btn" lay-filter="add" lay-submit="">提交</button>
        </div>

        <input type="hidden" name="id" value="<?php echo $data['id'];?>">
    </form>
</div>
</body>

<script type="text/html" id="params_script_box">
    <tr>
        <td class="parameter-mm-table-td" width="300px"><input type="text" class="coo-input" name="params[model][]" value=""></td>
        <td class="parameter-mm-table-td" width="300px"><input type="text" class="coo-input" name="params[working][]" value=""></td>
        <td class="parameter-mm-table-td" width="300px"><input type="text" class="coo-input" name="params[laser][]" value=""></td>
        <td class="parameter-mm-table-td" width="300px"><input type="text" class="coo-input" name="params[size][]" value=""></td>
        <td class="parameter-mm-table-td" width="260px"><span class="" style="display: block;width: 100px">删除</span></td>
    </tr>
</script>
<script type="text/html" id="element_script_box">
    <li class="parts-li set_{{element}}_init" data-id="{{element_id}}">
        <div class="product-img-spans-box" onclick="_setPushSelectElement(this)" data-id="{{element_id}}" data-element="{{element}}">
            <div class="product-img-shadow-box">
                <div class="product-img-shadow-son {{checked}}">
                    <div class="product-img-shadow-icon-select">
                        <span style="margin-top: 45px;"><i class="icon iconfont"></i></span>
                    </div>
                    <span class="product-img-shadow-span" ></span>
                </div>
            </div>
            <img class="parts-li-img" src="{{img_url}}">
        </div>
        <div class="parts-li-div">{{element_name}}</div>
    </li>
</script>


<script type="text/html" id="element_select_script_box">
    <li class="parts-li">
        <div class="product-img-spans-box" onclick="_removeSelectElement(this)" data-id="{{element_id}}" data-element="{{element}}">
            <div class="product-img-shadow-box">
                <div class="product-img-shadow-son ">
                    <div class="product-img-shadow-icon">
                        <span style="margin-top: 45px;"><i class="icon iconfont"></i></span>
                    </div>
                    <span class="product-img-shadow-span" ></span>
                </div>
            </div>
            <img  class="parts-li-img" src="{{img_url}}">
        </div>
        <div class="parts-li-div">{{element_name}}</div>
        <input type="hidden" name="{{element}}_input[]" value="{{element_id}}" class="{{element}}_input">
    </li>
</script>


<script type="text/html" id="img_script_box">
    <span onclick="_removeThis(this)" title="点击删除图片" class="img-spans-box">
         <div class="img-shadow-box">
            <div class="img-shadow-box-son">
                <div class="img-shadow-icon">
                    <span><i class="icon iconfont"></i></span>
                </div>
                <span class="img-shadow-span"></span>
            </div>
        </div>
        <img class="product-img" src="{{value}}">
        <input type="hidden" name="{{key}}" value="{{value}}">
    </span>
</script>

</html>
<script>
    var ue = UE.getEditor('editor');
    var ue = UE.getEditor('editor1',{
        textarea:'canshu'
    });
    $("#editor").css('height', '240px');


    var pushElement = function(element, data, select_arr){
        var html = $("#element_script_box").html();
        html = html.replace("{{element}}", element);
        html = html.replace("{{element}}", element);
        html = html.replace("{{img_url}}", data.img_url);
        html = html.replace("{{element_name}}", data.name);
        html = html.replace("{{element_id}}", data.id);
        html = html.replace("{{element_id}}", data.id);
        if($.inArray(data.id, select_arr) >= 0){
            html = html.replace("{{checked}}", 'display-block');
        } else {
            html = html.replace("{{checked}}", '');
        }
        return html;
    };

    var _setPushSelectElement = function (obj) {
        var img_url = $(obj).find('img').attr('src');
        var element = $(obj).data('element');
        var element_id = $(obj).data('id');
        var element_name = $(obj).parent().find('.parts-li-div').text();
        if($(obj).find(".product-img-shadow-son").hasClass("display-block")){
            layer.msg('当前数据已选择');
            return false;
        }
        $(obj).find(".product-img-shadow-son").addClass("display-block");
        var html = $("#element_select_script_box").html();
        html = html.replace("{{img_url}}", img_url);
        html = html.replace("{{element_name}}", element_name);
        html = html.replace("{{element}}", element);
        html = html.replace("{{element}}", element);
        html = html.replace("{{element}}", element);
        html = html.replace("{{element_id}}", element_id);
        html = html.replace("{{element_id}}", element_id);
        $(".select_"+element+"_ul").append(html);
    };

    var _removeSelectElement = function (obj) {
        var element = $(obj).data('element');
        var element_id = $(obj).data('id');
        layer.confirm('确认删除吗？', {
            btn : [ '确定', '取消' ]
        }, function(index) {
            var element_obj = $(".set_"+element+"_init[data-id="+element_id+"]");
            $(element_obj).find(".product-img-shadow-son").removeClass("display-block");
            $(obj).parent().remove();
            layer.msg('数据已删除');
        });
    };

    var _requestPost = function (obj, request_url, element, request_data) {
        if(!request_data){
            request_data = {category_id:$(obj).data('id'),type:3}
        }
        var element_obj = $(".set_"+element+"_ul");
        $.post(request_url, request_data,
            function(res) {
                if(res.code === 200 && res.data.length >= 1){
                    $(".set_"+element+"_ul").empty();
                    var element_input = $("."+element+"_input");
                    var element_input_arr = [];
                    $.each(element_input, function () {
                        element_input_arr.push(parseInt($(this).val()));
                    });

                    $.each(res.data, function (key, val) {
                        var html = pushElement(element, val, element_input_arr);

                        element_obj.append(html);
                    });
                }else {
                    element_obj.html('<span style="text-align: center;width: 100%;display: inline-block">暂无数据</span>');
                    return false;
                }
            }, 'json');
        $("."+element+"-category").removeClass('coo-btn-blue').addClass('coo-btn-df');
        $(obj).addClass('coo-btn-blue');
    };

    $(".parts-category").click(function () {
        var category_id = $(this).data('id');
        _requestPost(this, '/admin/product/getPartsList', 'parts', {category_id:category_id});
    });
    _requestPost($(".parts-category").eq(0), '/admin/product/getPartsList', 'parts');

    $(".sample-category").click(function () {
        var category_id = $(this).data('id');
        _requestPost(this, '/admin/product/getSampleList', 'sample', {category_id:category_id});
    });
    _requestPost($(".sample-category").eq(0), '/admin/product/getSampleList', 'sample');

    $(".application-category").click(function () {
        var category_id = $(this).data('id');
        _requestPost(this, '/admin/product/getApplicationList', 'application', {category_id:category_id});
    });
    _requestPost($(".application-category").eq(0), '/admin/product/getApplicationList', 'application');

    $(".lore-category").click(function () {
        var category_id = $(this).data('id');
        _requestPost(this, '/admin/product/getNewsList', 'lore', {category_id:category_id,type:3});
    });
    _requestPost($(".lore-category").eq(0), '/admin/product/getNewsList', 'lore');

    $(".bujian-category").click(function () {
        var category_id = $(this).data('id');
        _requestPost(this, '/admin/product/getBuJianList', 'bujian', {category_id:category_id,type:1});
    });
    _requestPost($(".bujian-category").eq(0), '/admin/product/getBuJianList', 'bujian');

    $(".product-category").click(function () {
        var category_id = $(this).data('id');
        _requestPost(this, '/admin/product/getProductList', 'product', {category_id:category_id});
    });
    _requestPost($(".product-category").eq(0), '/admin/product/getBuJianList', 'product');


    var _paramsDataPushRow = function () {
        var table_obj = $(".params-data-table").find('tbody');
        var technical_script = $("#params_script_box").html();
        table_obj.append(technical_script);
    };

    var _paramsDataRemoveRow = function (obj) {
        layer.confirm('确认删除吗？', {
            btn : [ '确定', '取消' ]
        }, function(index) {
            $(obj).parent().parent().remove();
            layer.msg('数据已删除');
        });
    };
    /*产品参数*/


    var _technicalDataMmPushRow = function () {
        var obj = $(".tech-data-table").find('tbody').find('.data-box:last');
        var td_length = $(obj).find('td').length - 2;
        var technical_script = $("#technical_script_box").html();
        var technical_x_html = '<td class="parameter-mm-table-td technical_mm_rows"><input type="text" class="coo-input" name="technical_mm_x[]"></td>';
        for (var i = 0; i <= td_length-1; i ++){
            technical_x_html += ' <td class="parameter-mm-table-td technical_mm_data"><input type="text" class="coo-input" name="technical_mm_data[][]" value=""></td>';
        }
        technical_x_html += '<td class="parameter-mm-table-td" width="100px"><div style="width: 100px;cursor: pointer;" onclick="_technicalDataMmRemoveRow(this)">删除当前行</div></td>';
        $(".tech-data-table").find('tbody > .data-opc').before("<tr class='data-box'>"+technical_x_html+"</tr>");
        var objcc = $(".tech-data-table").find('tbody > .data-box');
        $.each(objcc, function () {
            var index = $(this).index();
            $(this).find('.technical_mm_rows').find("input").attr('name', 'technical_mm_x['+index+']');
            $(this).find('.technical_mm_data').find("input").attr('name', 'technical_mm_data['+index+'][]');
        });

        var header_box = $(".tech-data-table > thead > tr").find(".technical_mm_header");
        $.each(header_box, function () {
            var index = $(this).index();
            $(this).find("input").attr('name', 'technical_mm_y['+index+']');
        })
    };

    var _technicalDataMmRemoveRow = function (obj) {
        layer.confirm('确认删除吗？', {
            btn : [ '确定', '取消' ]
        }, function(index) {
            var length = $(obj).parent().parent().parent().find('.data-box').length;
            if(length <= 1){
                layer.msg('基础行不可删除');
            } else {
                $(obj).parent().parent().remove();
                layer.msg('数据已删除');
            }
            var objcc = $(".tech-data-table").find('tbody > .data-box');
            $.each(objcc, function () {
                var index = $(this).index();
                $(this).find('.technical_mm_rows').find("input").attr('name', 'technical_mm_x['+index+']');
                $(this).find('.technical_mm_data').find("input").attr('name', 'technical_mm_data['+index+'][]');
            });

            var header_box = $(".tech-data-table > thead > tr").find(".technical_mm_header");
            $.each(header_box, function () {
                var index = $(this).index();
                $(this).find("input").attr('name', 'technical_mm_y['+index+']');
            })
        });

    };

    var _technicalDataMmPushColumn = function () {
        var html = '<th class="parameter-mm-table-th technical_mm_header" style="width: 150px"><input type="text" class="coo-input" name="technical_mm_y[]" value=""> </th>';
        $(".tech-data-table").find('thead').find('tr').find('th:last').before(html);

        var tbody_tr = $(".tech-data-table").find('tbody > .data-box');
        $.each(tbody_tr, function () {
            var html = '<td class="parameter-mm-table-td technical_mm_data"><input type="text" class="coo-input" name="technical_mm_data[][]" value=""></td>'
            $(this).find('td:last').before(html);
        });

        var html = '<td class="parameter-mm-table-td"  width="100px"><div style="width: 100px;cursor: pointer;" onclick="_technicalDataMmRemoveColumn(this)">删除当前列</div></td>';
        $(".tech-data-table").find('tbody > .data-opc').find('td:last').before(html);

        var objcc = $(".tech-data-table").find('tbody > .data-box');
        $.each(objcc, function () {
            var index = $(this).index();
            $(this).find('.technical_mm_rows').find("input").attr('name', 'technical_mm_x['+index+']');
            $(this).find('.technical_mm_data').find("input").attr('name', 'technical_mm_data['+index+'][]');
        });

        var header_box = $(".tech-data-table > thead > tr").find(".technical_mm_header");
        $.each(header_box, function () {
            var index = $(this).index();
            $(this).find("input").attr('name', 'technical_mm_y['+index+']');
        })
    };

    var _technicalDataMmRemoveColumn = function (obj) {
        layer.confirm('确认删除吗？', {
            btn : [ '确定', '取消' ]
        }, function(res) {
            var index = $(obj).parent().index();
            var data_box_tr = $(".tech-data-table").find('tbody').find('tr');
            $.each(data_box_tr, function () {
                $(this).find('td').eq(index).remove();
            });
            $(".tech-data-table").find('thead').find('tr').find('th').eq(index).remove();
            $(obj).parent().remove();
            layer.msg('数据已删除');
            var objcc = $(".tech-data-table").find('tbody > .data-box');
            $.each(objcc, function () {
                var index = $(this).index();
                $(this).find('.technical_mm_rows').find("input").attr('name', 'technical_mm_x['+index+']');
                $(this).find('.technical_mm_data').find("input").attr('name', 'technical_mm_data['+index+'][]');
            });

            var header_box = $(".tech-data-table > thead > tr").find(".technical_mm_header");
            $.each(header_box, function () {
                var index = $(this).index();
                $(this).find("input").attr('name', 'technical_mm_y['+index+']');
            })

        });
    };

    var _technicalDataInchPushRow = function () {
        var obj = $(".tech-data-inch-table").find('tbody').find('.data-box:last');
        var td_length = $(obj).find('td').length - 2;
        var technical_script = $("#technical_script_box").html();
        var technical_x_html = '<td class="parameter-mm-table-td technical_inch_rows"><input type="text" class="coo-input" name="technical_inch_x[]"></td>';
        for (var i = 0; i <= td_length-1; i ++){
            technical_x_html += ' <td class="parameter-mm-table-td technical_inch_data"><input type="text" class="coo-input" name="technical_inch_data[][]" value=""></td>';
        }
        technical_x_html += '<td class="parameter-mm-table-td" width="100px"><div style="width: 100px;cursor: pointer;" onclick="_technicalDataInchRemoveRow(this)">删除当前行</div></td>';
        $(".tech-data-inch-table").find('tbody > .data-opc').before("<tr class='data-box'>"+technical_x_html+"</tr>");
        var objcc = $(".tech-data-inch-table").find('tbody > .data-box');
        $.each(objcc, function () {
            var index = $(this).index();
            $(this).find('.technical_inch_rows').find("input").attr('name', 'technical_inch_x['+index+']');
            $(this).find('.technical_inch_data').find("input").attr('name', 'technical_inch_data['+index+'][]');
        });

        var header_box = $(".tech-data-inch-table > thead > tr").find(".technical_inch_header");
        $.each(header_box, function () {
            var index = $(this).index();
            $(this).find("input").attr('name', 'technical_inch_y['+index+']');
        });
    };

    var _technicalDataInchRemoveRow = function (obj) {
        layer.confirm('确认删除吗？', {
            btn : [ '确定', '取消' ]
        }, function(index) {
            var length = $(obj).parent().parent().parent().find('.data-box').length;
            if(length <= 1){
                layer.msg('基础行不可删除');
            } else {
                $(obj).parent().parent().remove();
                layer.msg('数据已删除');
            }
            var objcc = $(".tech-data-inch-table").find('tbody > .data-box');
            $.each(objcc, function () {
                var index = $(this).index();
                $(this).find('.technical_inch_rows').find("input").attr('name', 'technical_inch_x['+index+']');
                $(this).find('.technical_inch_data').find("input").attr('name', 'technical_inch_data['+index+'][]');
            });

            var header_box = $(".tech-data-inch-table > thead > tr").find(".technical_inch_header");
            $.each(header_box, function () {
                var index = $(this).index();
                $(this).find("input").attr('name', 'technical_inch_y['+index+']');
            })
        });

    };

    var _technicalDataInchPushColumn = function () {
        var html = '<th class="parameter-mm-table-th technical_inch_header" style="width: 150px"><input type="text" class="coo-input" name="technical_inch_y[]" value=""> </th>';
        $(".tech-data-inch-table").find('thead').find('tr').find('th:last').before(html);

        var tbody_tr = $(".tech-data-inch-table").find('tbody > .data-box');
        $.each(tbody_tr, function () {
            var html = '<td class="parameter-mm-table-td technical_inch_data"><input type="text" class="coo-input" name="technical_inch_data[][]" value=""></td>'
            $(this).find('td:last').before(html);
        });

        var html = '<td class="parameter-mm-table-td"  width="100px"><div style="width: 100px;cursor: pointer;" onclick="_technicalDataInchRemoveColumn(this)">删除当前列</div></td>';
        $(".tech-data-inch-table").find('tbody > .data-opc').find('td:last').before(html);

        var objcc = $(".tech-data-inch-table").find('tbody > .data-box');
        $.each(objcc, function () {
            var index = $(this).index();
            $(this).find('.technical_inch_rows').find("input").attr('name', 'technical_inch_x['+index+']');
            $(this).find('.technical_inch_data').find("input").attr('name', 'technical_inch_data['+index+'][]');
        });

        var header_box = $(".tech-data-inch-table > thead > tr").find(".technical_inch_header");
        $.each(header_box, function () {
            var index = $(this).index();
            $(this).find("input").attr('name', 'technical_inch_y['+index+']');
        });
    };

    var _technicalDataInchRemoveColumn = function (obj) {
        layer.confirm('确认删除吗？', {
            btn : [ '确定', '取消' ]
        }, function(res) {
            var index = $(obj).parent().index();
            var data_box_tr = $(".tech-data-inch-table").find('tbody').find('tr');
            $.each(data_box_tr, function () {
                $(this).find('td').eq(index).remove();
            });
            $(".tech-data-inch-table").find('thead').find('tr').find('th').eq(index).remove();
            $(obj).parent().remove();
            layer.msg('数据已删除');
            var objcc = $(".tech-data-inch-table").find('tbody > .data-box');
            $.each(objcc, function () {
                var index = $(this).index();
                $(this).find('.technical_inch_rows').find("input").attr('name', 'technical_inch_x['+index+']');
                $(this).find('.technical_inch_data').find("input").attr('name', 'technical_inch_data['+index+'][]');
            });

            var header_box = $(".tech-data-inch-table > thead > tr").find(".technical_inch_header");
            $.each(header_box, function () {
                var index = $(this).index();
                $(this).find("input").attr('name', 'technical_inch_y['+index+']');
            })
        });
    };


    var _removeThis = function (obj) {
        layer.confirm('确认删除图片吗？', {
            btn : [ '确定', '取消' ]
        }, function(index) {
            $(obj).parent().find(".file_site").remove();
            $(obj).remove();
            layer.msg('数据已删除');
        });
    };

    var img_script_box = function (value, key, zip) {
        var img_url = value;
        if(zip){
            img_url = zip;
        }
        var img_script = '<span onclick="_removeThis(this)" title="点击删除图片" class="img-spans-box">' +
            '         <div class="img-shadow-box">' +
            '            <div class="img-shadow-box-son">' +
            '                <div class="img-shadow-icon">' +
            '                    <span><i class="icon iconfont"></i></span>' +
            '                </div>' +
            '                <span class="img-shadow-span"></span>' +
            '            </div>' +
            '        </div>' +
            '        <img class="product-img" src="'+img_url+'">' +
            '        <input type="hidden" name="'+key+'" value="'+value+'">' +
            '    </span>';
        layer.msg('上传成功');
        return img_script;

    }
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form,layer = layui.layer;

        form.on('submit(add)', function(data){
            $.post('/admin/product/updateProduct', data.field, function(res) {
                if(res.code===200){
                    layer.msg('添加成功', {
                        time: 1000, //不自动关闭
                        icon:6,
                        end:function () {
                            location.href = '/admin/product/lists'
                        }
                    });
                    return false;
                }else {
                    layer.msg(res.msg)
                }


            });

        });

    });

    var imgupUrl = '/admin/index/imgUp';
    var varzipUrl = '/admin/index/zipUp';
    layui.use('upload', function(){
        var upload = layui.upload;
        upload.render({
            elem: '#product_cover_button' //绑定元素
            ,url: imgupUrl //上传接口
            ,done: function(res){
                var html = img_script_box(res.data, 'cover_img[]');
                $('.product_cover_box').append(html);
            }
            ,error: function(){
                //请求异常回调
            }
        });
        //执行实例
        upload.render({
            elem: '#product_img_button' //绑定元素
            ,url: imgupUrl //上传接口
            ,done: function(res){
                var html = img_script_box(res.data, 'product_img[]');
                $('.product_img_box').append(html);
            }
            ,error: function(){
                //请求异常回调
            }
        });
        upload.render({
            elem: '#product_tel_button' //绑定元素
            ,url: imgupUrl //上传接口
            ,done: function(res){
                var html = img_script_box(res.data, 'tel_product_img[]');
                $('.product_tel_box').append(html);
            }
            ,error: function(){
                //请求异常回调
            }
        });
        upload.render({
            elem: '#params_mm_img_button' //绑定元素
            ,url: imgupUrl //上传接口
            ,done: function(res){
                var option = img_script_box(res.data, 'params_mm_img');
                $('.params_mm_img_box').html(option);
            }
            ,error: function(){
                //请求异常回调
            }
        });

        upload.render({
            elem: '#params_inch_img_button' //绑定元素
            ,url: imgupUrl //上传接口
            ,done: function(res){
                var option = img_script_box(res.data, 'params_inch_img');
                $('.params_inch_img_box').html(option);
            }
            ,error: function(){
                //请求异常回调
            }
        });

        upload.render({
            elem: '#tech_data_mm_img_button' //绑定元素
            ,accept: 'file'
            ,url: varzipUrl //上传接口
            ,done: function(res){
                var option = "<div class='file_site'>文件地址："+res.data+"</div>";
                option += img_script_box(res.data, 'technical_mm_img', '__ADMIN__images/zip.png');
                $('.tech_data_mm_img_box').html(option);
            }
            ,error: function(){
                //请求异常回调
            }
        });

        upload.render({
            elem: '#tech_data_inch_img_button' //绑定元素
            ,accept: 'file'
            ,url: varzipUrl //上传接口
            ,done: function(res){
                var option = "<div class='file_site'>文件地址："+res.data+"</div>";
                option += img_script_box(res.data, 'technical_inch_img', '__ADMIN__images/zip.png');
                $('.tech_data_inch_img_box').html(option);
            }
            ,error: function(){
                //请求异常回调
            }
        });

        upload.render({
            elem: '#deffect_img_button' //绑定元素
            ,accept: 'file'
            ,url: '/admin/index/uploadZip' //上传接口
            ,before:function(){
                var loading = layer.load(2,{
                    shade: 0.3,
                    content: '<div style="width:200px;margin-top:40px;text-align:center;margin-left:15px;">文件上传中，请稍候...</div>', time:100000000,
                });
            }
            ,done: function(res){
                layer.closeAll();
                var option = "<div class='file_site'>文件地址："+res.data+"</div>";
                option += img_script_box(res.data, 'deffect_img', '__ADMIN__images/zip.png');
                $('.deffect_img_box').html(option);

            }
            ,error: function(){
                //请求异常回调
            }
        });

        upload.render({
            elem: '#deffect_two_img_button' //绑定元素
            ,url: imgupUrl //上传接口
            ,done: function(res){
                var option = img_script_box(res.data, 'deffect_two_img[]');
                $('.deffect_two_img_box').append(option);
            }
            ,error: function(){
                //请求异常回调
            }
        });

    });
</script>